package com.ldl.exam.util;

/**
 * @author liudaolin
 * @version 1.0
 * @date 2022/10/02 15:28:54
 */
public class AjaxResult {
    private String msg;
    private boolean success;
    private Object data;
    private int status;

    public AjaxResult() {
    }

    public AjaxResult(String msg, boolean success, Object data, int status) {
        this.msg = msg;
        this.success = success;
        this.data = data;
        this.status = status;
    }

    public static AjaxResult isOk(String msg, Object data) {
        return new AjaxResult(msg, true, data, 200);
    }
    public static AjaxResult isOk(String msg) {
        return new AjaxResult(msg, true, null, 200);
    }
    public static AjaxResult isFail(String msg, Object data) {
        return new AjaxResult(msg, false, data, 500);
    }
    public static AjaxResult isFail(String msg) {
        return new AjaxResult(msg, false, null, 500);
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
